<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<div class="row">
	<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12 text-right">
		<t-auth:roleButton />
	</div>
</div>
<script type="text/javascript">
function addData(){
	top.openModal("/stock/outStock/detailed?type="+"add","outStock_form","出库详情-添加",1100,500);
}

function editData(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/stock/outStock/detailed?key="+id,"outStock_form","出库详情-修改",1100,500);
	}
}

function selData(){
	var key=getKeyId();
	if(isEditor(key)){
		top.openModal("/stock/outStock/detailed?key="+key+"&type="+"check","outStock_form","出库详情-查看",1100,500);
	
	}
}

function deleteData(){
	 var id=getKeyId();
	 if (isEditor(id)) {
		 var url = $.getVirtualPath()+"/stock/outStock/delete?key="+id;
		 deleteDataEx(url, searchCallback);
    } 
}

function exportData(){
	var url=$.getVirtualPath()+"/stock/stock/exportExcel";
	var data=$("form:first").serialize();
	var cachedId=$.getText(url,data);
	downloadExcel(cachedId);
}

//关闭出库单
function closeOutStock(){
	var id=getKeyId();
	var id=getKeyId();
	var type=$(".cntable.table>tbody>tr.select-tr").attr("data-type");
	var billingType=$(".cntable.table>tbody>tr.select-tr").attr("data-billingType");
	if(type!="2" && billingType!="close"){
		if(isEditor(id)){
			confirm("是否确认关闭订单？",function(result){
				if(result){
					var url = $.getVirtualPath()+"/stock/outStock/closeOutStock";
				    var msg =  $.getJsonPost(url,"key="+id);
				    console.log(msg);
				    $.showTips(msg.message,1000,msg.resultType);
				    formSubmit();
				}
			});
	    }
	}else{
		$.showTips("此发货单不允许关闭！",1000,"warning");
	}
}

//申请修改
function submitModify(){
	var id=getKeyId();
	var type=$(".cntable.table>tbody>tr.select-tr").attr("data-type");
	var billingType=$(".cntable.table>tbody>tr.select-tr").attr("data-billingType");
	if(type!="2" && billingType!="close"){
		if(isEditor(id)){
			top.openModal("/stock/outStock/submitModifyDetailed?key="+id+"&type="+"modify","billing_form","出库订单-修改",1100,550);
		}
	}else{
		$.showTips("此发货单不允许编辑！",1000,"warning");
	}
	

}

//确人修改
function affirmModify(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/stock/outStock/affirmModifyDetailed?key="+id+"&type="+"modify","billing_form","订单详情-修改",1100,540);
	}
}

function exportMaterialAll(){
	var id=getKeyId();
	if(isEditor(id)){
		var url = $.getVirtualPath()+"/stock/outStock/exportDetailed?key="+id;
		window.open(url);
	}

}

</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
